﻿using JESAI.EventBus.Events;
using JESAI.EventBus.ExcutedResults;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace JESAI.EventBus.PublishManagers
{
    public interface IEventPublishManager
    {
        /// <summary>
        /// 处理结果回调事件
        /// </summary>
        public event EventHandler<EventHandleResult> OnGrobalPublishedCallBack;

        Task PublishAsync(IEvent eventSource);

        Task PublishDelayAsync(IEvent eventSource, long delay);

        Task PublishAsync(string eventId, object payload = default, CancellationToken cancellationToken = default);

        Task PublishAsync(Enum eventId, object payload = default, CancellationToken cancellationToken = default);
        //Task PublishAsync<T>(T eventId, object payload = default, CancellationToken cancellationToken = default);

        Task PublishDelayAsync(string eventId, long delay, object payload = default, CancellationToken cancellationToken = default);

        Task PublishDelayAsync(Enum eventId, long delay, object payload = default, CancellationToken cancellationToken = default);

        //Task PublishDelayAsync<T>(T eventId, long delay, object payload = default, CancellationToken cancellationToken = default);

        Task PublishTimerAsync(string eventId, DateTime dateTime, object payload = default, CancellationToken cancellationToken = default);

        Task PublishTimerAsync(Enum eventId, DateTime dateTime, object payload = default, CancellationToken cancellationToken = default);

        //Task PublishTimerAsync<T>(T eventId, DateTime dateTime, object payload = default, CancellationToken cancellationToken = default);

        void GrobalPublishedCallback(EventHandleResult result);
    }
}
